<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link rel="stylesheet" href="//gysres.bookuu.com/cloud/css/layui.css?v=20190101" type="text/css" />
    <link rel="stylesheet" href="//gysres.bookuu.com/cloud/css/public.css?v=20190101" type="text/css" />
    <link rel="stylesheet" href="//gysres.bookuu.com/cloud/css/base.css?v=20190101" type="text/css" />
    <link rel="stylesheet" href="//gysres.bookuu.com/cloud/css/login.css?v=20191201" type="text/css" />
    <link rel="stylesheet" href="//gysres.bookuu.com/cloud/css/iconfont.css?v=20190101" type="text/css" />
    <link rel="shortcut icon" href="//gysres.bookuu.com/cloud/images/favicon.ico" type="image/x-icon" />
    <script type="text/javascript" charset="utf-8" src="//g.alicdn.com/sd/ncpc/nc.js?t=2015052012"></script>
    <title>供应商云系统</title>
    <style type="text/css">
      .nc_scale div.nc_bg {
        background: #6293de !important;
      }
    </style>
</head>
<body>
    <div class="layui-header header">
        <div class="layui-main layui-clear">
            <div class="logo">
                <img class="fr" src="//gysres.bookuu.com/cloud/images/logo.png" alt="">
            </div>
            <div class="logo-name fl">
                <h1 class="logo-name-title">供应商云系统</h1>
                <p>SUPPLIER CLOUD SYSTEM</p>
            </div>
        </div>
    </div>
    <div class="layui-row" style="background-color: #283d66;">
        <div class="content">
            <div class="sign-banner layui-clear">
                <div class="ban-shop">
                    <img src="//gysres.bookuu.com/cloud/images/login-main.png" alt="">
                </div>
                <div class="sign-frame">
                    <form class="layui-form" method="post">
                        <h3 class="sign-title">用户登录</h3>
                        <div class="sign-form-item">
                            <div class="layui-form-item">
                                <input value="徐妙" type="text" name="username" placeholder="请输入用户名" class="layui-input" lay-verify="required" style="width: 100%;height: 38px">
                            </div>
                            <div class="layui-form-item">
                                <input value="Immortal2021.." type="password" name="password" placeholder="请输入密码" class="layui-input" lay-verify="required" style="width: 100%;height: 38px">
                            </div>
                            <div class="layui-form-item">
                                <div id="login-verify" class="nc-container"></div>
                            </div>
                            <div class="layui-form-item">
                                <a class="layui-btn layui-btn-fluid" lay-submit lay-filter="login">登录</a>
                                <input type="hidden" name="token" value="">
                                <input type="hidden" name="sessionid" value="">
                                <input type="hidden" name="sig" value="">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row" style="text-align: center;margin-top: 10px;">
        <p>Copyright 2005-2019 bookuu.com 版权所有</p>
        <p>增值电信业务经营许可证:浙B2-20110278</p>
    </div>
    <script src="//gysres.bookuu.com/cloud/js/layui.js"></script>
    <script type="text/javascript">
        layui.use(['layer','form'], function () {

            var nc_token = ["FFFF0N00000000006020", (new Date()).getTime(), Math.random()].join(':');
            var NC_Opt =
            {
                renderTo: "#login-verify",
                appkey: "FFFF0N00000000006020",
                scene: "nc_login",
                token: nc_token,
                customWidth: 300,
                trans:{"key1":"code0"},
                elementID: ["usernameID"],
                is_Opt: 0,
                language: "cn",
                isEnabled: true,
                timeout: 3000,
                times:5,
                apimap: {
                    // 'analyze': '//a.com/nocaptcha/analyze.jsonp',
                    // 'get_captcha': '//b.com/get_captcha/ver3',
                    // 'get_captcha': '//pin3.aliyun.com/get_captcha/ver3'
                    // 'get_img': '//c.com/get_img',
                    // 'checkcode': '//d.com/captcha/checkcode.jsonp',
                    // 'umid_Url': '//e.com/security/umscript/3.2.1/um.js',
                    // 'uab_Url': '//aeu.alicdn.com/js/uac/909.js',
                    // 'umid_serUrl': 'https://g.com/service/um.json'
                },
                callback: function (data) {
                    $('input[name=token]').val(nc_token);
                    $('input[name=sessionid]').val(data.csessionid);
                    $('input[name=sig]').val(data.sig);
                }
            }
            var nc = new noCaptcha(NC_Opt)
            nc.upLang('cn', {
                _startTEXT: "请按住滑块，拖动到最右边",
                _yesTEXT: "验证通过lll",
                _error300: "哎呀，出错了，点击<a href=\"javascript:__nc.reset()\">刷新</a>再来一次",
                _errorNetwork: "网络不给力，请<a href=\"javascript:__nc.reset()\">点击刷新</a>",
            })
            console.log(nc)
            var layer = layui.layer,
            form = layui.form,
            $ = layui.jquery,
            is_captcha = false;
            form.on('submit(login)', function(data) {
                if (!data.field.token || !data.field.sessionid || !data.field.sig) {
                    layer.msg('请拖动滑块完成验证');
                    return false;
                }
                if (!data.field.username) {
                    layer.msg('用户名不能为空');
                    return false;
                }
                if (!data.field.password) {
                    layer.msg('密码不能为空');
                    return false;
                }
                $.post('/bokuOs/loginApi', data.field, function(result) {
                    if(result.code === 0) {
                        alert('用户名或密码错误')
                        window.location.reload()
                    } else {
                        if(window.location.search) {
                            const urlParams = new URLSearchParams(window.location.search)
                            const by = decodeURIComponent(urlParams.get('by'));
                            const to = decodeURIComponent(urlParams.get('from'))
                            const isbn = urlParams.get('isbn')
                            const serialNo = urlParams.get('serialNo')
                            window.location.href = `${to}?username=${data.field.username}&phpsessid=${result.phpsessid}&by=${by}&isbn=${isbn}&serialNo=${serialNo}`
                        }
                    }
                }, 'json');
            });

            var _isIE = isIE();
            if (_isIE) {
                layer.msg('使用当前浏览器(或浏览器模式)，网站部分功能使用受限，请使用其它浏览器，建议使用谷歌浏览器。如果使用360、QQ等浏览器，请使用极速模式(点击地址栏图标进行切换)。', { time: 30000 });
            }

            function isIE() {
                if (!!window.ActiveXObject || "ActiveXObject" in window){
                    return true;
                }else{
                    return false;
                }
            }
        });
    </script>
</body>
</html>
